import { IsEnum, IsNotEmpty, IsOptional, MaxLength } from 'class-validator'
import i18n, { i18nMessage } from '@/i18n'
import { DomainModel } from '@apps/flow/domain/model'
import { ApiProperty } from '@nestjs/swagger'

export class FlowFileTreeDto {
  @ApiProperty({ description: '平台标识' })
  @IsNotEmpty()
  @MaxLength(64, { message: i18nMessage() })
  platform: string

  @ApiProperty({ description: '平台下项目' })
  @MaxLength(64, { message: i18nMessage() })
  @IsOptional()
  project?: string

  @ApiProperty({
    description: '文件类型',
    enum: DomainModel.ApiPropertyEnum.FlowFileType,
  })
  @IsNotEmpty()
  @IsEnum(DomainModel.FlowFileType)
  type: DomainModel.FlowFileType
}
